package mianshi.threesix;


import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class T1 {

    public static void main(String[] args) {
        int count = Integer.MIN_VALUE;
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        Map<String,Integer> map = new HashMap<>();
        for (int i = 0; i < s.length(); i++) {
            for (int j = i+1; j <=s.length(); j++) {
               map.putIfAbsent(s.substring(i,j),0);
               map.put(s.substring(i,j),map.get(s.substring(i,j))+1);
                count  = Math.max(map.get(s.substring(i,j)),count);
            }
        }
//        for (Map.Entry<String, Integer> entry : map.entrySet()) {
//            count  = Math.max(entry.getValue(),count);
//        }
        System.out.println(count);

    }
}
